package com.headfirst.observer.version2;

import java.util.Observable;

/**
 * @author sunhongguang
 * @create 2022-01-18-23:25
 */
public class WeatherData_v2 extends Observable {
    private float temperature;
    private float humidity;
    private float pressure;

    public WeatherData_v2() {
    }

    public void measurementsChanged() {
        setChanged();
        notifyObservers();
    }

    public void setMeasurements(float temperature, float humidity, float pressure) {
        this.temperature = temperature;
        this.humidity = humidity;
        this.pressure = pressure;
        measurementsChanged();
    }

    public float getTemperature(){
        return temperature;
    }

    public float getHumidity(){
        return humidity;
    }

    public float getPressure(){
        return pressure;
    }
}
